<?php
class ProdutoModel extends DBBase 
{
	
	public $name = 'Produto';
	
	private $limit = 20;
	
	function getAllForCategoria($id)
	{
		$filter = new QueryFilter();
		$filter->addFilter('categoria_id',$id);
		
		$parametros = array(
		'cat'=>$id,		
		);
		
		$display = array(
		//'sql' => 'SELECT * FROM categoria', 
		//'prepare' => array()
		'limit'=> $this->limit,
		'filter'=> $filter,
		'parametres'=>$parametros
		);
			
	//	DebugUtil::PrintValue($this->pagination($display));exit;
		return $this->pagination($display);
	}
	
	function getAllForSearch($value)
	{		
		$parametros = array(
		'search'=>$value,
		);
		
		$display = array(
			'sql' => 'SELECT * FROM produto WHERE nome LIKE ? ORDER BY preco DESC', 
			'prepare' => array("%$value%"),
			'limit'=> $this->limit,
			'post'=> true,
			'parametres'=>$parametros
		);
		
			//DebugUtil::PrintValue($this->pagination($display));exit;
		return $this->pagination($display);
	}
}

?>